//
//  BaseNaviViewController.swift
//  MetaU
//
//  Created by PerhapYs on 2022/4/7.
//

import UIKit

class BaseNaviViewController: UINavigationController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.interactivePopGestureRecognizer?.delegate = self
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        //隐藏系统提供的navigationBar
        self.navigationBar.isHidden = true
    }
    
    /// 是否显示状态栏
    override var prefersStatusBarHidden: Bool{
        
        return false
    }
    //设置状态栏样式,setNeedsStatusBarAppearanceUpdate
    override var preferredStatusBarStyle: UIStatusBarStyle{
        
        return .default
    }
}
extension BaseNaviViewController :UIGestureRecognizerDelegate{
    
    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        
        if self.topViewController is ChooseLocalVideoViewController{
            self.dismiss(animated: true)
            return false
        }
        else if self.topViewController is PhoneLoginViewController{
            
            PYLoginManager.popLoginViewController()
            return false
        }
        return true
    }
}
